home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Format 25
/
PCFormat 1993-10.iso
/
UTILS.ZIP
/
EXISTDIR.TXT
< prev
next >
Wrap
Text File
|
1992-05-20
|
3KB
|
56 lines
EXISTDIR: check existence of some "name" as a file or subdirectory.
By Jim Groeneveld, Netherlands, 20/5-92.
Package EXISTDIR contains the following files:
CHKEX BAT 541 3-22-91 Initial version, using 'pathname\NUL'
CHKEXIST BAT 543 3-22-91 Similar version, differently written
CHKEXNET BAT 853 5-20-92 1:00a Improved version, also for networks
CHKXPATH BAT 1067 5-20-92 1:00a Similar version, creates check files
CHKXPATH COM 2177 5-20-92 1:00a Compiled version of above
CHKEXDRV BAT 195 5-20-92 1:00a Application checks existence of drives
EXISTDIR TXT 3205 5-20-92 1:00a This accompanying describing text file
Both initial versions (22/3-91) work all right on standalone PC's.
They check existence (or not) of some name as a disk file or subdirectory.
One may adapt them for specific purposes, e.g. replacing the textual output
by environment variable definitions. It's simple standard DOS language.
In order to test for the existence of subdirectories the DOS command
'IF EXIST pathname\NUL rem pathname is an existing (sub)directory'
has been used. It appeared that this did not work correctly on
networkdrives or even on local drives with specific network software loaded.
That's too bad, but IBM/Microsoft never guaranteed this tric.
That's why CHKEXNET, and following programs, have been written in which the
check is performed by writing a unique temporary file (of length 0) to the
supposed directory and checking the existence of that file. This works in
all instances. However, if the disk is write protected, the test result will
always be negative ('name does not exist').
CHKXPATH is an alternative of CHKEXNET in which the textual output has been
replaced by the creation of (0-byte) files in the current directory with
specific names, indicating the existence or not of the tested name as a file or
(non-)empty (sub)directory. If the analyzed drive is write protected or the
directory table is full, the temporary files can not be written and this method
can not be used.
Subdirectories will be regarded 'empty' by this test if they do not contain
files, regardless of whether they do contain other subdirectories. This can not
be discriminated (with older DOS versions, can DOS 5?).
Take care to set environment variables from a compiled batch file. These
are lost after termination of the program! Or one should use specific
programs to manipulate the base environment, such as the package SETENVJW.
For usage help and application just enter the BATch file name from the DOS
prompt without a parameter.
──────────────────────────────────────────────────────────────────────────────
Centrum voor Medische Informatica TNO <Email> | | |\/|
TNO Center for Medical Informatics | GROENEVELD@CMI.TNO.NL | \_/ | | |
( CMI-TNO ) | Y. Groeneveld | GROENEVELD@CMIHP1.UUCP | Jim Groeneveld
P.O.Box 124 | Wassenaarseweg 56 | GROENEVELD@TNO.NL | Schoolweg 14
2300 AC Leiden | 2333 AL Leiden | ...@HDETNO51.BITNET | 8071 BC Nunspeet
Nederland. | (+31|0)71-181810 | Fax (+31|0)71-176382 | 03412-60413